package com.lin.netty.chat.handler;

import com.lin.netty.chat.message.LoginRequestMessage;
import com.lin.netty.chat.message.LoginResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 登录请求消息入站处理器
 */
@Slf4j
public class LoginResponseMessageHandler extends SimpleChannelInboundHandler<LoginResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, LoginResponseMessage msg) throws Exception {

        if (!msg.isSuccess()) {
            log.debug("退出程序：{}", msg.getReason());
            ctx.channel().close();
        }
    }
}
